const Electron = require('electron')
const shell = Electron.shell
import { createNotify } from '@/util/notification'
import axios from 'axios'

/**
 * 右键菜单选项
 * @param {Object} data 当前选中数据
 * @param {string} k 键值
 * @param {function} func 点击后执行的方法
 * @returns {Array} 菜单选项数组
 */
function getMenuItem(data, k, func = () => {}) {
    let menuItems = []
    menuItems = [
        {
            label: '播放',
            click: () => {
                func(data, k, 'play')
                // createNotify('播放事件', '播放失败').show()
            },
        },
        {
            label: '详细信息',
            click: async () => {
                func(data, k, 'moreInfo')
                // shell.openExternal(data.url)
            },
        },
        {
            label: '隐藏',
            click: () => {
                console.log('隐藏')
            },
        },
        {
            label: '收藏',
            click: () => {
                console.log('隐藏')
                const res = axios.get('/koa')
                console.log(res)
            },
        },
        {
            label: '删除',
            click: () => {
                console.log('删除')
                func(data, k, 'delete')
            },
        },
    ]
    return menuItems
}

export { getMenuItem }
